/**
 * Created by BigBi on 2017/4/10.
 */
/**
 * 文件压缩
 */

var fs = require('fs');
var zlib = require('zlib');

//执行压缩
fs.createReadStream('test.txt')
   .pipe(zlib.createGzip(),function(err){
       console.log('出错：',err);
   })
   .pipe(fs.createWriteStream('input.txt.gz'));

console.log("文件压缩完成。");
